public class Company {
    private String name;
    private int numberEmployee = 0;
    private int idEmployee = 0;
    private final int MAX_EMPLOYEE = 10;
    private First[] firstAll = new First[MAX_EMPLOYEE];

    public Company(String name) {
        this.name = name;
    }

    public void addEmployee(String name, int number, boolean isHour) {
        if (numberEmployee < MAX_EMPLOYEE) {
            if (isHour) {
                firstAll[numberEmployee] = new HourEmployee(name, number);
            } else {
                firstAll[numberEmployee] = new MonthEmployee(name, number);
            }
            firstAll[numberEmployee].setId(++idEmployee);
            numberEmployee++;
        } else {
            System.out.println("This employee does not fit!");
        }
    }

    public void viewEmployee() {
        System.out.println("List of employees with their monthly salary:");
        for (int id = 0; id < numberEmployee; id++) {
            System.out.println(firstAll[id].getName() + " " + firstAll[id].calcSalary());
        }
    }

    public void showName() {
        System.out.println(this.name);
    }

    public void delEmployee(int idEmployee) {
        for (int id = 0; id < numberEmployee; id++) {
            if (firstAll[id].getId() == idEmployee) {
                for (; id < numberEmployee-1; id++) {
                    firstAll[id] = firstAll[id + 1];
                }
            }
        }
        firstAll[--numberEmployee] = null;
    }
}
